package com.cy.config;

import com.cy.interceptor.LoginInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * 时间：2023/1/4
 */
@Configuration
//将自定义拦截器进行注册
public class LoginInterceptorConfigurer implements WebMvcConfigurer {
    /**
     * 配置拦截器
     * @param registry
     */
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new LoginInterceptor()).addPathPatterns("/**")
                        .excludePathPatterns("/bootstrap3/**","/css/**","/images/**","/js/**","/web/register.html",
                                "/web/login.html","/web/index.html","/web/product.html","/users/reg","/users/login","/districts/**",
                                "/products/**");
    }
}
